// 
// Decompiled by Procyon v0.5.36
// 

package com.cyberfend.cyfsecurity;

import android.annotation.*;
import java.lang.ref.*;
import android.app.*;
import android.view.*;
import android.os.*;
import android.provider.*;
import android.util.*;
import android.content.*;
import java.util.*;
import com.akamai.botman.*;

@java.lang.Deprecated
@android.annotation.SuppressLint({ "Registered" })
public class CYFMonitor
{
    public static final int INFO = 4;
    public static final int WARN = 5;
    public static final int ERROR = 6;
    public static final int NONE = 15;
    private static com.akamai.botman.h a;
    private static boolean b;
    private static boolean c;
    private static boolean d;
    private static boolean e;
    
    public static synchronized void initialize(final android.app.Application app) {
        android.util.Log.i("CYFMonitor", "Initializing Akamai BMP Monitor");
        if (com.cyberfend.cyfsecurity.CYFMonitor.d) {
            return;
        }
        final long uptimeMillis = android.os.SystemClock.uptimeMillis();
        com.akamai.botman.al.a("CYFMonitor", "Registering activity lifecycle callbacks", new java.lang.Throwable[0]);
        final com.akamai.botman.ad a;
        (a = com.akamai.botman.ad.a()).a = new java.lang.ref.WeakReference<android.content.Context>((android.content.Context)app);
        new java.lang.Thread(new java.lang.Runnable() {
            @java.lang.Override
            public final void run() {
                com.akamai.botman.ad.a(a);
            }
        }).start();
        a(app);
        com.cyberfend.cyfsecurity.CYFMonitor.a.c(app);
        com.cyberfend.cyfsecurity.CYFMonitor.a.b(app);
        com.cyberfend.cyfsecurity.CYFMonitor.a.a(app);
        app.registerActivityLifecycleCallbacks((android.app.Application.ActivityLifecycleCallbacks)new com.akamai.botman.a());
        com.cyberfend.cyfsecurity.CYFMonitor.d = true;
        com.cyberfend.cyfsecurity.CYFMonitor.c = true;
        com.akamai.botman.al.a("CYFMonitor", "Initialize-Time: " + (android.os.SystemClock.uptimeMillis() - uptimeMillis) + "ms", new java.lang.Throwable[0]);
    }
    
    public static synchronized java.lang.String getSensorData() {
        return com.cyberfend.cyfsecurity.CYFMonitor.a.a();
    }
    
    public static void setLogLevel(final int logLevel) {
        if ((logLevel < 4 || logLevel > 6) && logLevel != 15) {
            com.akamai.botman.al.c("CYFMonitor", "Invalid log level specified in setLogLevel(), ignoring.", new java.lang.Throwable[0]);
            return;
        }
        com.akamai.botman.al.a.b = logLevel;
    }
    
    @java.lang.Deprecated
    public static void setApiKey(final java.lang.String apiKey) {
    }
    
    @java.lang.Deprecated
    public static void setAccessSensorDataFromBackground(final boolean accessSensorDataFromBackground) {
    }
    
    @java.lang.Deprecated
    public static synchronized void startCollectingSensorData(final android.app.Activity activity) {
        if (com.cyberfend.cyfsecurity.CYFMonitor.c) {
            return;
        }
        final android.app.Application application;
        a(application = activity.getApplication());
        com.cyberfend.cyfsecurity.CYFMonitor.a.c(application);
        com.cyberfend.cyfsecurity.CYFMonitor.a.b(application);
        com.cyberfend.cyfsecurity.CYFMonitor.a.a(application);
        a(activity);
    }
    
    @java.lang.Deprecated
    public static synchronized void stopCollectingSensorData() {
        if (com.cyberfend.cyfsecurity.CYFMonitor.c) {
            return;
        }
        a();
    }
    
    public static void configure(final java.lang.String sessionId, final java.lang.String apiKey, final java.lang.String apiBaseUrl) {
        setApiKey(apiKey);
        setApiUrl(apiBaseUrl);
        setSessionId(sessionId);
    }
    
    public static void setSensorDataFieldNames(final java.lang.String[] fieldNames) {
        if (fieldNames != null && fieldNames.length > 0) {
            com.akamai.botman.d.c = fieldNames[0];
        }
    }
    
    public static void setSessionId(final java.lang.String sessionId) {
        try {
            if (android.os.Looper.myLooper() == android.os.Looper.getMainLooper()) {
                com.akamai.botman.b.a(sessionId);
                return;
            }
            new android.os.Handler(android.os.Looper.getMainLooper()).post((java.lang.Runnable)new java.lang.Runnable() {
                @java.lang.Override
                public final void run() {
                    com.akamai.botman.b.a(sessionId);
                }
            });
        }
        catch (java.lang.Exception ex) {
            new java.lang.StringBuilder("Exception occurred:").append(ex.getMessage());
            final java.lang.Throwable[] array = new java.lang.Throwable[0];
        }
    }
    
    public static void setAutoPost(final boolean isEnable) {
        com.akamai.botman.d.d = isEnable;
    }
    
    public static void setAutoPostWakeUpTime(final long newResetInterval) {
        com.akamai.botman.d.h = newResetInterval;
    }
    
    public static void setAutoPostDataTransmissionLimit(final int newTransmissionLimit) {
        com.akamai.botman.d.k = newTransmissionLimit;
    }
    
    public static void setApiUrl(final java.lang.String apiUrl) {
        if (apiUrl.endsWith("/")) {
            com.akamai.botman.d.b = apiUrl;
            return;
        }
        com.akamai.botman.d.b = apiUrl + "/";
    }
    
    public static void setActivityVisible(final boolean activityVisible) {
        com.cyberfend.cyfsecurity.CYFMonitor.e = activityVisible;
    }
    
    public static boolean isActivityVisible() {
        return com.cyberfend.cyfsecurity.CYFMonitor.e;
    }
    
    public static void a(final android.app.Activity activity) {
        try {
            com.akamai.botman.al.a("CYFMonitor", "Start collecting sensor data", new java.lang.Throwable[0]);
            if (com.akamai.botman.d.e == 0L) {
                com.akamai.botman.d.e = android.os.SystemClock.uptimeMillis();
            }
            if (com.akamai.botman.d.a == 0L) {
                com.akamai.botman.d.a = java.lang.System.currentTimeMillis();
            }
            com.cyberfend.cyfsecurity.CYFMonitor.a.f();
            com.cyberfend.cyfsecurity.CYFMonitor.a.d();
            if (!com.akamai.botman.h.a(activity.getWindow())) {
                com.cyberfend.cyfsecurity.CYFMonitor.a.b(activity.getWindow());
                com.cyberfend.cyfsecurity.CYFMonitor.a.a((android.view.ViewGroup)activity.findViewById(16908290));
            }
            if (com.akamai.botman.d.d && com.akamai.botman.d.g == 0) {
                com.akamai.botman.b.a(0);
            }
        }
        catch (java.lang.Exception ex) {
            (new java.lang.Throwable[1])[0] = ex;
        }
    }
    
    public static void a() {
        try {
            com.akamai.botman.al.a("CYFMonitor", "Stop collecting sensor data", new java.lang.Throwable[0]);
            com.cyberfend.cyfsecurity.CYFMonitor.a.g();
            com.cyberfend.cyfsecurity.CYFMonitor.a.e();
        }
        catch (java.lang.Exception ex) {
            (new java.lang.Throwable[1])[0] = ex;
        }
    }
    
    private static synchronized void a(android.app.Application application2) {
        if (!com.cyberfend.cyfsecurity.CYFMonitor.b && application != null) {
            try {
                new com.akamai.botman.u();
                final long uptimeMillis = android.os.SystemClock.uptimeMillis();
                com.akamai.botman.al.a("SystemInfoListener", "Getting system information", new java.lang.Throwable[0]);
                if (application != null) {
                    final java.lang.String s = "-1";
                    application.getPackageManager();
                    final android.util.DisplayMetrics displayMetrics;
                    final int heightPixels = (displayMetrics = application.getResources().getDisplayMetrics()).heightPixels;
                    final int widthPixels = displayMetrics.widthPixels;
                    final android.content.Intent registerReceiver;
                    int intExtra;
                    final android.util.Pair pair = ((registerReceiver = application.registerReceiver((android.content.BroadcastReceiver)null, new android.content.IntentFilter("android.intent.action.BATTERY_CHANGED"))) == null) ? new android.util.Pair((java.lang.Object)java.lang.Boolean.FALSE, (java.lang.Object)0) : new android.util.Pair((java.lang.Object)((intExtra = registerReceiver.getIntExtra("status", -1)) == 2 || intExtra == 5), (java.lang.Object)registerReceiver.getIntExtra("level", -1));
                    final int n = (application.getResources().getConfiguration().orientation == 1) ? 1 : ((application.getResources().getConfiguration().orientation == 2) ? 2 : -1);
                    final java.lang.String language = java.util.Locale.getDefault().getLanguage();
                    final java.lang.String release = android.os.Build$VERSION.RELEASE;
                    final int n2 = (android.provider.Settings$System.getInt(application.getContentResolver(), "accelerometer_rotation", 0) == 1) ? 1 : 0;
                    final java.lang.String model = android.os.Build.MODEL;
                    final java.lang.String bootloader = android.os.Build.BOOTLOADER;
                    java.lang.String hardware = "-1";
                    if (android.os.Build$VERSION.SDK_INT >= 8) {
                        hardware = android.os.Build.HARDWARE;
                    }
                    final java.lang.String s2 = "-1";
                    final java.lang.String packageName = application.getPackageName();
                    final java.lang.String s3 = "-1";
                    java.lang.String s4;
                    if (android.os.Build$VERSION.SDK_INT >= 26) {
                        s4 = android.provider.Settings$Secure.getString(application.getContentResolver(), "android_id");
                    }
                    else {
                        final android.content.SharedPreferences sharedPreferences;
                        if ((s4 = (sharedPreferences = application.getSharedPreferences("com.akamai.botman.preferences", 0)).getString("ifv", "-1")) == "-1") {
                            s4 = java.util.UUID.randomUUID().toString();
                            final android.content.SharedPreferences$Editor edit;
                            (edit = sharedPreferences.edit()).putString("ifv", s4);
                            edit.commit();
                        }
                    }
                    int n3;
                    if (((android.content.Context)application).getResources().getConfiguration().keyboard != 1) {
                        n3 = 1;
                    }
                    else {
                        n3 = 0;
                    }
                    application2 = (android.app.Application)((android.os.Build$VERSION.SDK_INT >= 17) ? android.provider.Settings$Global.getInt(((android.content.Context)application).getContentResolver(), "adb_enabled", 0) : android.provider.Settings$Secure.getInt(((android.content.Context)application).getContentResolver(), "adb_enabled", 0));
                    java.lang.String codename = "-1";
                    java.lang.String incremental = "-1";
                    int sdk_INT = -1;
                    java.lang.String manufacturer = "-1";
                    java.lang.String product = "-1";
                    java.lang.String tags = "-1";
                    java.lang.String type = "-1";
                    java.lang.String user = "-1";
                    java.lang.String display = "-1";
                    java.lang.String board = "-1";
                    java.lang.String brand = "-1";
                    java.lang.String device = "-1";
                    java.lang.String fingerprint = "-1";
                    java.lang.String host = "-1";
                    java.lang.String id = "-1";
                    try {
                        codename = android.os.Build$VERSION.CODENAME;
                        incremental = android.os.Build$VERSION.INCREMENTAL;
                        sdk_INT = android.os.Build$VERSION.SDK_INT;
                        manufacturer = android.os.Build.MANUFACTURER;
                        product = android.os.Build.PRODUCT;
                        tags = android.os.Build.TAGS;
                        type = android.os.Build.TYPE;
                        user = android.os.Build.USER;
                        display = android.os.Build.DISPLAY;
                        board = android.os.Build.BOARD;
                        brand = android.os.Build.BRAND;
                        device = android.os.Build.DEVICE;
                        fingerprint = android.os.Build.FINGERPRINT;
                        host = android.os.Build.HOST;
                        id = android.os.Build.ID;
                    }
                    catch (java.lang.Exception ex2) {}
                    final java.lang.String string = s + ",uaend,-1," + heightPixels + "," + widthPixels + "," + (((boolean)pair.first) ? 1 : 0) + "," + pair.second + "," + n + "," + com.akamai.botman.t.d(language) + "," + com.akamai.botman.t.d(release) + "," + n2 + "," + com.akamai.botman.t.d(model) + "," + com.akamai.botman.t.d(bootloader) + "," + com.akamai.botman.t.d(hardware) + "," + com.akamai.botman.t.d(s2) + "," + packageName + "," + com.akamai.botman.t.d(s3) + ",-1," + s4 + ",-1," + n3 + "," + (int)application2 + "," + com.akamai.botman.t.d(codename) + "," + com.akamai.botman.t.d(incremental) + "," + sdk_INT + "," + com.akamai.botman.t.d(manufacturer) + "," + com.akamai.botman.t.d(product) + "," + com.akamai.botman.t.d(tags) + "," + com.akamai.botman.t.d(type) + "," + com.akamai.botman.t.d(user) + "," + com.akamai.botman.t.d(display) + "," + com.akamai.botman.t.d(board) + "," + com.akamai.botman.t.d(brand) + "," + com.akamai.botman.t.d(device) + "," + com.akamai.botman.t.d(fingerprint) + "," + com.akamai.botman.t.d(host) + "," + com.akamai.botman.t.d(id);
                    com.akamai.botman.al.a("SystemInfoListener", "System Info: ".concat(java.lang.String.valueOf(string)), new java.lang.Throwable[0]);
                    com.akamai.botman.e.l = string;
                }
                com.akamai.botman.d.p = android.os.SystemClock.uptimeMillis() - uptimeMillis;
                com.akamai.botman.al.a("CYFSystemInfoManager", "DeviceInfo-Time: " + com.akamai.botman.d.p + "ms", new java.lang.Throwable[0]);
                com.cyberfend.cyfsecurity.CYFMonitor.b = true;
            }
            catch (java.lang.Exception ex) {
                new java.lang.StringBuilder("Exception occurred:").append(ex.getMessage());
                final java.lang.Throwable[] array = new java.lang.Throwable[0];
                com.akamai.botman.f.a(ex);
            }
        }
    }
    
    public static com.akamai.botman.h b() {
        return com.cyberfend.cyfsecurity.CYFMonitor.a;
    }
    
    public static java.util.HashMap<java.lang.Integer, java.lang.String> collectTestData() {
        try {
            final com.akamai.botman.h a = com.cyberfend.cyfsecurity.CYFMonitor.a;
            final java.util.HashMap<java.lang.Integer, java.lang.String> hashMap;
            (hashMap = new java.util.HashMap<java.lang.Integer, java.lang.String>()).put(0, java.lang.Long.toString(com.akamai.botman.e.j));
            hashMap.put(1, java.lang.Integer.toString(com.akamai.botman.e.e));
            hashMap.put(2, java.lang.Integer.toString(50));
            hashMap.put(3, java.lang.Integer.toString(com.akamai.botman.e.f));
            hashMap.put(4, java.lang.Integer.toString(50));
            hashMap.put(5, java.lang.Long.toString(a.a.d.size()));
            hashMap.put(6, java.lang.Integer.toString(0));
            hashMap.put(7, java.lang.Integer.toString(30));
            hashMap.put(8, java.lang.Long.toString(a.b.d.size()));
            hashMap.put(9, java.lang.Integer.toString(0));
            hashMap.put(10, java.lang.Integer.toString(30));
            hashMap.put(11, java.lang.Long.toString(com.akamai.botman.e.i));
            hashMap.put(12, java.lang.Integer.toString(com.akamai.botman.e.h));
            hashMap.put(13, java.lang.Integer.toString(9));
            return hashMap;
        }
        catch (java.lang.Exception ex) {
            return null;
        }
    }
    
    static {
        android.util.Log.i("CYFMonitor", "Initializing Akamai BMP SDK Version 2.2.2");
        new java.lang.Thread(new java.lang.Runnable() {
            final /* synthetic */ com.akamai.botman.ac a = com.akamai.botman.ac.a();
            
            @java.lang.Override
            public final void run() {
                com.akamai.botman.ac.a(this.a);
            }
        }).start();
        com.cyberfend.cyfsecurity.CYFMonitor.a = new com.akamai.botman.h();
        com.cyberfend.cyfsecurity.CYFMonitor.b = false;
        com.cyberfend.cyfsecurity.CYFMonitor.c = false;
        com.cyberfend.cyfsecurity.CYFMonitor.d = false;
        com.cyberfend.cyfsecurity.CYFMonitor.e = false;
    }
}
